﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
namespace XRPGLibrary.TileEngine
{
    public class Engine
    {
        #region Field Region
        static int tileWidth;//屏幕宽度方向上tile的个数
        static int tileHeight;//屏幕高度方向上tile的个数
        #endregion
        #region Property Region//这两个属性的对外接口
        public static int TileWidth
        {
            get { return tileWidth; }
        }
        public static int TileHeight
        {
            get { return tileHeight; }
        }
        #endregion
        #region Constructors
        public Engine(int tileWidth, int tileHeight)
        {
            Engine.tileWidth = tileWidth;
            Engine.tileHeight = tileHeight;
        }
        #endregion
        #region Methods//获取一个向量在tile矩阵中的位置
        public static Point VectorToCell(Vector2 position)
        {
            return new Point((int)position.X / tileWidth, (int)position.Y / tileHeight);
        }
        #endregion
    }
}